<?php

namespace App\Http\Controllers\Agency;

use App\Http\Controllers\Controller;
use App\Services\LineService;
use Illuminate\Http\Request;
use hg\apidoc\annotation as Apidoc;

/**
 * 牵线申请
 * @Apidoc\Group("service")
 */
class LineController extends Controller
{
    /**
     * @Apidoc\Title ("客户详情-更新牵线状态")
     * @Apidoc\Url("/agency/lineApplyStatusUpdate")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("id",type="int",require=true,desc="列表id")
     * @Apidoc\Param("status",type="string",require=true,desc="wait待审核；pass通过；refuse未通过")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */
    public function lineApplyStatusUpdate(Request $request ,LineService $lineService)
    {
        $params = $request->input();
        $result = $lineService->lineApplyStatusUpdate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }

    /**
     * @Apidoc\Title ("牵线申请列表")
     * @Apidoc\Url("/agency/lineApplyList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("type",type="int",desc="1发送者id；2接收者id；3发送者昵称；4接收者昵称；5发送者手机；6接收者手机")
     * @Apidoc\Param("keyword",type="string",desc="关键字")
     * @Apidoc\Param("status",type="string",require=true,desc="wait待审核；pass通过；refuse未通过")
     * @Apidoc\Returned("id",type="int",require=true,desc="id")
     * @Apidoc\Returned("base",type="object",require=true,desc="发起人信息")
     * @Apidoc\Returned("obase",type="object",require=true,desc="牵线对象信息")
     * @Apidoc\Returned("status",type="string",require=true,desc="牵线对象wait待审核；pass通过；refuse未通过")
     * @Apidoc\Returned("created_at",type="string",require=true,desc="申请时间")
     * @Apidoc\Returned("updated_at",type="string",require=true,desc="完成时间")
     *
     */

    public function lineApplyList(Request $request ,LineService $lineService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $lineService->lineApplyList($params);
        return $this->responseSuccess($result);
    }

    /**
     * @Apidoc\Title ("牵线申请列表-删除牵线申请")
     * @Apidoc\Url("/agency/lineApplyDel")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\RouteParam("id",type="int",require=true,desc="列表id")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function lineApplyDel(Request $request , LineService $lineService)
    {
        $params = $request->input();
        $result = $lineService->lineApplyDel($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }

    /**
     * @Apidoc\Title ("牵线套餐列表")
     * @Apidoc\Url("/agency/lineList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Returned("id",type="int",require=true,desc="id")
     * @Apidoc\Returned("name",type="object",require=true,desc="牵线套餐名称")
     * @Apidoc\Returned("nums",type="object",require=true,desc="牵线套餐次数")
     * @Apidoc\Returned("price",type="string",require=true,desc="牵线套餐价格")
     * @Apidoc\Returned("desc",type="string",require=true,desc="牵线套餐描述")
     * @Apidoc\Returned("created_at",type="string",require=true,desc="创建时间")
     *
     */

    public function lineList(Request $request ,LineService $lineService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $lineService->lineList($params);
        return $this->responseSuccess($result);
    }

    /**
     * @Apidoc\Title ("保存牵线套餐")
     * @Apidoc\Url("/agency/lineUpdate")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\RouteParam("id",type="int",require=true,desc="列表id")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function lineUpdate(Request $request , LineService $lineService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $lineService->lineUpdate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }

    /**
     * @Apidoc\Title ("更新牵线套餐状态")
     * @Apidoc\Url("/agency/lineStatusUpdate")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\RouteParam("id",type="int",require=true,desc="列表id")
     * @Apidoc\RouteParam("status",type="int",require=true,desc="Y启用N禁用")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function lineStatusUpdate(Request $request , LineService $lineService)
    {
        $params = $request->input();
        $result = $lineService->lineStatusUpdate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }
}
